Skip to content

Conversation

@dhairyashiil
Copy link
Member

@dhairyashiil dhairyashiil commented Nov 18, 2025

What does this PR do?

Visual Demo

Tested for both scenarios

  1. when toggle is off
  2. when toggle is ON
Screen.Recording.2025-11-19.at.3.07.46.PM.mov

Summary by cubic

Fixes attendee privacy for paid seated events by sending seat-specific notifications after payment and honoring seatsShowAttendees. Addresses #25256 and CAL-6782 to prevent exposing other attendees’ details to each buyer.

  • Bug Fixes

    • Use sendScheduledSeatsEmailsAndSMS for seated events, emailing only the attendee who just completed payment.
    • Defer confirmation emails for paid seats until payment succeeds and respect workflow settings that disable standard host/attendee emails.
    • Link each booking seat to its paymentId and select the paying attendee when sending emails to avoid misrouted confirmations.
  • Migration

    • Add paymentId to BookingSeat with a unique index to track seat payments.

Written for commit 16b0760. Summary will update automatically on new commits.

@vercel
Copy link

vercel bot commented Nov 18, 2025

@dhairyashiil is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the 🐛 bug Something isn't working label Nov 18, 2025
@keithwillcode keithwillcode added the community-interns The team responsible for reviewing, testing and shipping low/medium community PRs label Nov 18, 2025
@pull-request-size pull-request-size bot added size/L and removed size/S labels Nov 19, 2025
@github-actions github-actions bot added the High priority Created by Linear-GitHub Sync label Nov 19, 2025
@dhairyashiil dhairyashiil marked this pull request as ready for review November 19, 2025 09:41
@dhairyashiil dhairyashiil requested a review from a team as a code owner November 19, 2025 09:41
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Nov 19, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 6 files

Prompt for AI agents (all 2 issues)

Understand the root cause of the following 2 issues and fix them.


<file name="apps/web/modules/bookings/views/bookings-single-view.tsx">

<violation number="1" location="apps/web/modules/bookings/views/bookings-single-view.tsx:169">
The Stripe polling loop always reloads the page every 2s until payment succeeds, so a failed/slow payment traps the user in an infinite reload loop.</violation>

<violation number="2" location="apps/web/modules/bookings/views/bookings-single-view.tsx:429">
Wrap the new &quot;Processing payment&quot; headline in t() so it participates in localization.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@CarinaWolli CarinaWolli requested a review from a team November 25, 2025 14:26
Copy link
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to fix this issue, let's follow these steps:

  1. Store the paymentId in the bookingSeat table.
  2. After a successful payment, query the seat using the passed paymentId to find the attendee/seat, and then send them an email

@github-actions github-actions bot marked this pull request as draft November 26, 2025 15:52
@anikdhabal anikdhabal closed this Nov 27, 2025
@anikdhabal anikdhabal reopened this Nov 27, 2025
…delivery

- Add paymentId field to BookingSeat model for direct payment tracking
- Update createNewSeat to link payment after seat creation
- Update RegularBookingService to link payment for first seat bookings
- Modify handlePaymentSuccess to use paymentId for accurate attendee identification
- Update getBooking to include paymentId in bookingSeat queries
- Add database migration for new paymentId column with unique index

This fixes the race condition where payment webhooks arriving out of order
could cause confirmation emails to be sent to the wrong attendee in paid
seated events. Now each seat directly references its payment for accurate
identification.
@dhairyashiil dhairyashiil marked this pull request as ready for review November 27, 2025 15:03
@github-actions github-actions bot added the ❗️ migrations contains migration files label Nov 27, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 7 files

Prompt for AI agents (all 2 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/features/bookings/lib/payment/getBooking.ts">

<violation number="1" location="packages/features/bookings/lib/payment/getBooking.ts:45">
Attendee phone numbers are fetched from Prisma even though the data is never used here, which unnecessarily exposes extra PII and goes against the guideline to select only required fields.</violation>
</file>

<file name="packages/prisma/migrations/20251127144146_add_payment_id_to_booking_seat/migration.sql">

<violation number="1" location="packages/prisma/migrations/20251127144146_add_payment_id_to_booking_seat/migration.sql:14">
Drop the redundant non-unique index on BookingSeat.paymentId; the unique index already covers lookups on this column and avoids extra storage/write overhead.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@dhairyashiil dhairyashiil marked this pull request as draft November 27, 2025 15:15
- Remove redundant regular index on BookingSeat.paymentId (unique index already provides lookup capability)
- Remove unused phoneNumber field from getBooking query (data never used in CalendarEvent)
- Regenerate migration with optimized schema

This reduces storage overhead and write operations while maintaining performance.
@dhairyashiil dhairyashiil marked this pull request as ready for review November 27, 2025 15:24
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 7 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/prisma/schema.prisma">

<violation number="1" location="packages/prisma/schema.prisma:1629">
`paymentId` is marked `@unique`, preventing multiple seats from referencing the same payment. Group bookings usually share one payment record, so subsequent seats will violate the unique constraint and fail to save. Drop the uniqueness so all seats in a booking can link to the same payment.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 7 files

Prompt for AI agents (all 2 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/prisma/schema.prisma">

<violation number="1" location="packages/prisma/schema.prisma:1629">
`paymentId` is intended to point to `Payment`, but it is just a plain Int column with no foreign-key relation, so invalid/nonexistent payment IDs can be stored and Prisma cannot traverse `bookingSeat.payment`. Declare a relation to `Payment` so referential integrity is enforced.</violation>
</file>

<file name="packages/app-store/_utils/payments/handlePaymentSuccess.ts">

<violation number="1" location="packages/app-store/_utils/payments/handlePaymentSuccess.ts:114">
Email confirmation disabling logic for hosts and attendees duplicates `packages/features/bookings/lib/handleConfirmation.ts` and several other files. This logic should be extracted into a shared utility function.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

E2E results are ready!

Comment on lines +1 to +4
/*
Warnings:
- A unique constraint covering the columns `[paymentId]` on the table `BookingSeat` will be added. If there are existing duplicate values, this will fail.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check this wanings

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning is normal and expected when adding a unique constraint. Since paymentId is a new column being added by this migration, there are no existing values in the database to conflict - all existing rows will have paymentId = NULL, which is allowed for unique constraints.

The migration will run successfully without any issues. This is just Prisma's standard safety reminder that appears whenever adding a unique constraint to warn about potential duplicate data (which doesn't apply in our case).

@dhairyashiil dhairyashiil marked this pull request as draft November 27, 2025 17:33
- Fix seatsShowAttendees default from undefined to false to prevent unintended attendee hiding
- Remove unnecessary comments from createNewSeat for cleaner code
@dhairyashiil dhairyashiil marked this pull request as ready for review November 27, 2025 17:41
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 7 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/features/bookings/lib/service/RegularBookingService.ts">

<violation number="1" location="packages/features/bookings/lib/service/RegularBookingService.ts:1838">
Attach the newly created bookingSeat to the attendee identified by the per-seat responses (email/phone), not always to the booker email, so that seat-specific emails/webhooks target the correct attendee.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions bot added the Stale label Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working community Created by Linear-GitHub Sync community-interns The team responsible for reviewing, testing and shipping low/medium community PRs High priority Created by Linear-GitHub Sync ❗️ migrations contains migration files ready-for-e2e size/L Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Seated Events with paid booking exposes all attendee emails

3 participants